package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.BadphenoType;
import com.indusfo.spc.service.BadphenoTypeService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @ProjectName: IEIS2-COM
 * @Package: com.indusfo.spc.controller
 * @ClassName: BadphenoTypeController
 * @Author: 熊冰
 * @Description: 不良现象类型 视图层
 * @Date: 2019/8/20 11:56
 * @Version: 1.0
 */

@Controller
@RequestMapping("/service/badphenoType")
public class BadphenoTypeController {
    /**
     * 注入service
     */

    @Resource
    BadphenoTypeService badphenoTypeService;
    //新增
    @RequestMapping(value="insertBadphenoType")
    @ResponseBody
    public JSONObject insertBadphenoType(BadphenoType badphenoType){
        badphenoType.setBadphenoTypeId(null);
        JSONObject json = badphenoTypeService.insertOrUpdateBadphenoType(badphenoType) ;
        return json;
    }
    
    //删除
    @RequestMapping(value="deleteBadphenoType")
    @ResponseBody
    public JSONObject deleteBadphenoType(Long[] ids){
        Integer   dataState = 2;
        JSONObject json = badphenoTypeService.deleteBadphenoType(ids,dataState);
        return json;
    }
    
    //修改
    @RequestMapping(value="updateBadphenoType")
    @ResponseBody
    public JSONObject updateBadphenoType(BadphenoType badphenoType){
        JSONObject json = badphenoTypeService.insertOrUpdateBadphenoType(badphenoType) ;
        return json;
    }
    
    //查询
    @RequestMapping(value="queryBadphenoType")
    @ResponseBody
    public JSONObject queryBadphenoType(BadphenoType badphenoType){
        JSONObject json = badphenoTypeService.listBadphenoType(badphenoType);
        return json;
    }

     //树
    @RequestMapping(value="treeBadphenoType")
    @ResponseBody
    public JSONObject treeBadphenoType(BadphenoType badphenoType){
        JSONObject json = badphenoTypeService.treeBadphenoType(badphenoType);
        return json;
    }

    //树end
    @RequestMapping(value="treeBadphenoTypeToInsert")
    @ResponseBody
    public JSONObject treeBadphenoTypeToInsert(BadphenoType badphenoType){
        JSONObject json = badphenoTypeService.treeBadphenoTypeToInsert(badphenoType);
        return json;
    }

}
